if (baseline)
    name='baseline';    
    evaluate;
    
    dlmwrite('../temp/insample_baseline.txt',insample);
    pbar(pbar~=pbar)=-1;
    X(X~=X)=-1;
    csvwrite('../temp/data_baseline.csv',[id pbar X])    
else
    load ../temp/insample_baseline.txt
    
    if (equal_wage)
        name='equal_wage';        
        aux=mean(W_m_base(married==0 & insample_data==1),'omitnan');
        
        W_m_base(married==0 & insample_data==1)=aux;
        W_m=W_m_base.*exp([expr_m expr_m.^2]*param_W_m);
        
        aux1=mean(W_m_base(married==1 & insample_data==1),'omitnan');
        aux2=mean(W_f_base(married==1 & insample_data==1),'omitnan');

        W_m_base(married==1 & insample_data==1)=aux1;
        W_f_base(married==1 & insample_data==1)=aux2;
        W_m=W_m_base.*exp([expr_m expr_m.^2]*param_W_m);
        W_f=W_f_base.*exp([expr_f expr_f.^2]*param_W_f);
        
        calculate_PDV;
    end
    
    if (equal_price)
        if (equal_wage)
            name='equal_wage_price';
        else
            name='equal_price';
        end
        aux=mean(p(insample_data==1),'omitnan');
        p(insample_data==1)=aux;
        
        aux=mean(P_c(insample_data==1),'omitnan');
        P_c(insample_data==1)=aux;
    end    

    if (equal_tech)
        name='equal_tech';        
        set_regressors;
    end
    
    if (equal_pref)
        name='equal_pref';
        param_alpha(1,2)=param_alpha(1,1);        
        param_psi_m(1,2)=param_psi_m(1,1);
        
        param_alpha(2,2)=param_alpha(2,1);        
        param_psi_m(2,2)=param_psi_m(2,1);
        param_psi_f(2,2)=param_psi_f(2,1);

        for m=1:2
            for e=1:2
                
                eval(['psi_m(ind' int2str(m) int2str(e) ')=param_psi_m(m,e);']);
                eval(['alpha(ind' int2str(m) int2str(e) ')=param_alpha(m,e);']);
                if (m==2)
                    eval(['psi_f(ind' int2str(m) int2str(e) ')=param_psi_f(m,e);']);
                else
                    eval(['psi_f(ind' int2str(m) int2str(e) ')=0;']);
                end
            end
        end
    end
    
    evaluate;
    
end

csvwrite(['../temp/outcome_' name '.csv'],outcome)
csvwrite(['../temp/doutcome_' name '.csv'],doutcome)                       
csvwrite(['../temp/vars_' name '.csv'],vars)
